
/** 게시판>게시판 를 호출되어지는 데이터 처리 Controller                                
* @FileName  : BoardController.java 0.1 2014년09월12일(14:05:50)       
* @Project     : nComz n-eip 프로젝트   
* @Date         : 2014년09월12일(14:05:50)          
* @작성자      : 신용천(nComz)           	  
* @변경이력 :                         
* @프로그램 설명 :게시판>게시판(Controller)    
* Copyright 2012 (주)nComz Cop. All rights Reserved.                  
*/ 

package com.sunny.hp.bd; 

import java.util.ArrayList; 
import java.util.LinkedHashMap; 
import java.util.LinkedList; 
import javax.servlet.http.HttpServletRequest; 
import javax.servlet.http.HttpServletResponse; 
import org.springframework.beans.factory.annotation.Autowired; 
import org.springframework.stereotype.Controller; 
import org.springframework.web.bind.annotation.RequestMapping; 
import org.springframework.web.servlet.view.json.MappingJacksonJsonView; 
import org.apache.commons.logging.Log; 
import org.apache.commons.logging.LogFactory; 
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;
import com.sunny.hp.common.vo.*;
import com.sunny.hp.bd.service.BoardService; 
import com.sunny.hp.common.servlet.ModelAndNCOMZView; 
import com.sunny.hp.common.util.HttpRequest; 
import com.sunny.hp.bd.service.BoardService;
import com.sunny.hp.bd.service.BoardService;

/** 게시판>게시판 를 호출되어지는 데이터 처리 Controller                               
* @ClassName  : BoardController       
* @Date         : 2014년09월12일(14:05:50)         
* @작성자      : 신용천(nComz)           	 
* @변경이력 :                        
* @프로그램 설명 :게시판>게시판(Controller)                     
*/      

@Controller
@RequestMapping("/bd")
public class BoardController {

	@Autowired
	private BoardService boardService; 

	protected final Log logger = LogFactory.getLog(getClass());

	/**  게시판>게시판>공지사항 게시판 					
	* @Method Name  : selectNoticeBoardView   		
	* @작성일   : 2014년09월12일(14:05:50)                    		
	* @작성자   : 신용천(nComz)                    		
	* @변경이력  :                           		
	* @Method 설명 : 공지사항 게시판                         		
	* @param request HttpServletRequest
	* @param response HttpServletResponse
	* @return mav                                	
	*/
 	@RequestMapping(value="/selectNoticeBoardView.do")
	public ModelAndNCOMZView selectNoticeBoardView(HttpServletRequest request, HttpServletResponse response) throws Exception {
			ModelAndNCOMZView mav   	= new ModelAndNCOMZView(request);
	mav.setViewName("bd/selectNoticeBoardView");

	return mav;
	}


	/**  게시판>게시판>일반 게시판  					
	* @Method Name  : selectBoardView   		
	* @작성일   : 2014년09월12일(14:05:50)                    		
	* @작성자   : 신용천(nComz)                    		
	* @변경이력  : sssss
	* dddddd
	* 33333
	* 4444                          		
	* @Method 설명 : 일반 게시판                          		
	* @param request HttpServletRequest
	* @param response HttpServletResponse
	* @return mav                                	
	*/
 	@RequestMapping(value="/selectBoardView.do")
	public ModelAndNCOMZView selectBoardView(HttpServletRequest request, HttpServletResponse response) throws Exception {
			ModelAndNCOMZView mav   	= new ModelAndNCOMZView(request);
	mav.setViewName("bd/selectBoardView");

	return mav;
	}


	/**  게시판>게시판>동영상 게시판 					
	* @Method Name  : selectMovieBoardView   		
	* @작성일   : 2014년09월12일(14:05:50)                    		
	* @작성자   : 신용천(nComz)                    		
	* @변경이력  :                           		
	* @Method 설명 : 동영상 게시판                         		
	* @param request HttpServletRequest
	* @param response HttpServletResponse
	* @return mav                                	
	*/
 	@RequestMapping(value="/selectMovieBoardView.do")
	public ModelAndNCOMZView selectMovieBoardView(HttpServletRequest request, HttpServletResponse response) throws Exception {
			ModelAndNCOMZView mav   	= new ModelAndNCOMZView(request);
	mav.setViewName("bd/selectMovieBoardView");

	return mav;
	}


	/**  게시판>게시판>게시글 리스트 가져오기 					
	* @Method Name  : selectBoardContentList   		
	* @작성일   : 2014년09월12일(14:05:50)                    		
	* @작성자   : 신용천(nComz)                    		
	* @변경이력  :                           		
	* @Method 설명 : 게시글 리스트 가져오기                         		
	* @param request HttpServletRequest
	* @param response HttpServletResponse
	* @return mav                                	
	*/
 	@RequestMapping(value="/ajax/selectBoardContentList.do")
	public ModelAndNCOMZView selectBoardContentList(HttpServletRequest request, HttpServletResponse response) throws Exception {
			ModelAndNCOMZView mav   	= new ModelAndNCOMZView(request,new MappingJacksonJsonView());
	HttpRequest requestUtil = new HttpRequest(request); 
	LinkedHashMap param = requestUtil.paramBind(); 
	ArrayList<LinkedHashMap> retList1 = new ArrayList<LinkedHashMap>();
	try {
		retList1 = (ArrayList<LinkedHashMap>)boardService.selectBoardContentList(param);
		mav.addObject("retList1", retList1); 
		} catch (Exception e) {
			e.printStackTrace(); 
		} 

	return mav;
	}


	/**  게시판>게시판>게시글 세부정보 가져오기 					
	* @Method Name  : selectBoardContentInfo   		
	* @작성일   : 2014년09월12일(14:05:50)                    		
	* @작성자   : 신용천(nComz)                    		
	* @변경이력  :                           		
	* @Method 설명 : 게시글 세부정보 가져오기                         		
	* @param request HttpServletRequest
	* @param response HttpServletResponse
	* @return mav                                	
	*/
 	@RequestMapping(value="/ajax/selectBoardContentInfo.do")
	public ModelAndNCOMZView selectBoardContentInfo(HttpServletRequest request, HttpServletResponse response) throws Exception {
			ModelAndNCOMZView mav   	= new ModelAndNCOMZView(request,new MappingJacksonJsonView());
	HttpRequest requestUtil = new HttpRequest(request); 
	LinkedHashMap param = requestUtil.paramBind(); 
	LinkedHashMap resultMap1 = new LinkedHashMap(); 
	try {
		resultMap1 = boardService.selectBoardContentInfo(param);
		mav.addObject("resultMap1", resultMap1); 
		} catch (Exception e) {
			e.printStackTrace(); 
		} 

	return mav;
	}


	/**  게시판>게시판>게시글 등록하기 					
	* @Method Name  : insertBoardContentInfo   		
	* @작성일   : 2014년09월12일(14:05:50)                    		
	* @작성자   : 신용천(nComz)                    		
	* @변경이력  :                           		
	* @Method 설명 : 게시글 등록하기                         		
	* @param request HttpServletRequest
	* @param response HttpServletResponse
	* @return mav                                	
	*/
 	@RequestMapping(value="/ajax/insertBoardContentInfo.do")
	public ModelAndNCOMZView insertBoardContentInfo(HttpServletRequest request, HttpServletResponse response) throws Exception {
			ModelAndNCOMZView mav   	= new ModelAndNCOMZView(request,new MappingJacksonJsonView());
	HttpRequest requestUtil = new HttpRequest(request); 
	LinkedHashMap param = requestUtil.paramBind(); 
	int resultInt1 = 0;
	int resultInt2 = 0;
	try {
		resultInt2 = boardService.selectBoardContentKey(param);
		resultInt1 = boardService.insertBoardContentInfo(param);
		
		mav.addObject("resultInt1", resultInt1); 
		mav.addObject("resultInt2", resultInt2); 
		} catch (Exception e) {
			e.printStackTrace(); 
		} 

	return mav;
	}


	/**  게시판>게시판>게시글 수정하기 					
	* @Method Name  : updateBoardContentInfo   		
	* @작성일   : 2014년09월12일(14:05:50)                    		
	* @작성자   : 신용천(nComz)                    		
	* @변경이력  :                           		
	* @Method 설명 : 게시글 수정하기                         		
	* @param request HttpServletRequest
	* @param response HttpServletResponse
	* @return mav                                	
	*/
 	@RequestMapping(value="/ajax/updateBoardContentInfo.do")
	public ModelAndNCOMZView updateBoardContentInfo(HttpServletRequest request, HttpServletResponse response) throws Exception {
			ModelAndNCOMZView mav   	= new ModelAndNCOMZView(request,new MappingJacksonJsonView());
	HttpRequest requestUtil = new HttpRequest(request); 
	LinkedHashMap param = requestUtil.paramBind(); 
	int resultInt1 = 0;
	try {
		resultInt1 = boardService.updateBoardContentInfo(param);
		mav.addObject("resultInt1", resultInt1); 
		} catch (Exception e) {
			e.printStackTrace(); 
		} 

	return mav;
	}


	/**  게시판>게시판>게시글 삭제하기 					
	* @Method Name  : deleteBoardContentInfo   		
	* @작성일   : 2014년09월12일(14:05:50)                    		
	* @작성자   : 신용천(nComz)                    		
	* @변경이력  :                           		
	* @Method 설명 : 게시글 삭제하기                         		
	* @param request HttpServletRequest
	* @param response HttpServletResponse
	* @return mav                                	
	*/
 	@RequestMapping(value="/ajax/deleteBoardContentInfo.do")
	public ModelAndNCOMZView deleteBoardContentInfo(HttpServletRequest request, HttpServletResponse response) throws Exception {
			ModelAndNCOMZView mav   	= new ModelAndNCOMZView(request,new MappingJacksonJsonView());
	HttpRequest requestUtil = new HttpRequest(request); 
	LinkedHashMap param = requestUtil.paramBind(); 
	int resultInt1 = 0;
	try {
		resultInt1 = boardService.deleteBoardContentInfo(param);
		mav.addObject("resultInt1", resultInt1); 
		} catch (Exception e) {
			e.printStackTrace(); 
		} 

	return mav;
	}


	/**  게시판>게시판>댓글 리스트 가져오기 					
	* @Method Name  : selectBoardCommentInfoList   		
	* @작성일   : 2014년09월12일(14:05:50)                    		
	* @작성자   : 신용천(nComz)                    		
	* @변경이력  :                           		
	* @Method 설명 : 댓글 리스트 가져오기                         		
	* @param request HttpServletRequest
	* @param response HttpServletResponse
	* @return mav                                	
	*/
 	@RequestMapping(value="/ajax/selectBoardCommentInfoList.do")
	public ModelAndNCOMZView selectBoardCommentInfoList(HttpServletRequest request, HttpServletResponse response) throws Exception {
 		
			ModelAndNCOMZView mav   	= new ModelAndNCOMZView(request,new MappingJacksonJsonView());
	HttpRequest requestUtil = new HttpRequest(request); 
	LinkedHashMap param = requestUtil.paramBind(); 
	ArrayList<LinkedHashMap> retList1 = new ArrayList<LinkedHashMap>();
	try {
		retList1 = (ArrayList<LinkedHashMap>)boardService.selectBoardCommentInfoList(param);
		mav.addObject("retList1", retList1); 
		} catch (Exception e) {
			e.printStackTrace(); 
		} 

	return mav;
	}


	/**  게시판>게시판>댓글 세부정보 가져오기 					
	* @Method Name  : selectBoardCommentInfo   		
	* @작성일   : 2014년09월12일(14:05:50)                    		
	* @작성자   : 신용천(nComz)                    		
	* @변경이력  :                           		
	* @Method 설명 : 댓글 세부정보 가져오기                         		
	* @param request HttpServletRequest
	* @param response HttpServletResponse
	* @return mav                                	
	*/
 	@RequestMapping(value="/ajax/selectBoardCommentInfo.do")
	public ModelAndNCOMZView selectBoardCommentInfo(HttpServletRequest request, HttpServletResponse response) throws Exception {
			ModelAndNCOMZView mav   	= new ModelAndNCOMZView(request,new MappingJacksonJsonView());
	HttpRequest requestUtil = new HttpRequest(request); 
	LinkedHashMap param = requestUtil.paramBind(); 
	LinkedHashMap resultMap1 = new LinkedHashMap(); 
	try {
		resultMap1 = boardService.selectBoardCommentInfo(param);
		mav.addObject("resultMap1", resultMap1); 
		} catch (Exception e) {
			e.printStackTrace(); 
		} 

	return mav;
	}


	/**  게시판>게시판>댓글 등록하기 					
	* @Method Name  : insertBoardCommentInfo   		
	* @작성일   : 2014년09월12일(14:05:50)                    		
	* @작성자   : 신용천(nComz)                    		
	* @변경이력  :                           		
	* @Method 설명 : 댓글 등록하기                         		
	* @param request HttpServletRequest
	* @param response HttpServletResponse
	* @return mav                                	
	*/
 	@RequestMapping(value="/ajax/insertBoardCommentInfo.do")
	public ModelAndNCOMZView insertBoardCommentInfo(HttpServletRequest request, HttpServletResponse response) throws Exception {
			ModelAndNCOMZView mav   	= new ModelAndNCOMZView(request,new MappingJacksonJsonView());
	HttpRequest requestUtil = new HttpRequest(request); 
	LinkedHashMap param = requestUtil.paramBind(); 
	int resultInt1 = 0;
	int resultInt2 = 0;
	try {
		resultInt1 = boardService.insertBoardCommentInfo(param);
		resultInt2 = boardService.selectBoardCommentKey(param);
		mav.addObject("resultInt1", resultInt1); 
		mav.addObject("resultInt2", resultInt2); 
		} catch (Exception e) {
			e.printStackTrace(); 
		} 

	return mav;
	}


	/**  게시판>게시판>댓글 수정하기 					
	* @Method Name  : updateBoardCommentInfo   		
	* @작성일   : 2014년09월12일(14:05:50)                    		
	* @작성자   : 신용천(nComz)                    		
	* @변경이력  :                           		
	* @Method 설명 : 댓글 수정하기                         		
	* @param request HttpServletRequest
	* @param response HttpServletResponse
	* @return mav                                	
	*/
 	@RequestMapping(value="/ajax/updateBoardCommentInfo.do")
	public ModelAndNCOMZView updateBoardCommentInfo(HttpServletRequest request, HttpServletResponse response) throws Exception {
			ModelAndNCOMZView mav   	= new ModelAndNCOMZView(request,new MappingJacksonJsonView());
	HttpRequest requestUtil = new HttpRequest(request); 
	LinkedHashMap param = requestUtil.paramBind(); 
	int resultInt1 = 0;
	try {
		resultInt1 = boardService.updateBoardCommentInfo(param);
		mav.addObject("resultInt1", resultInt1); 
		} catch (Exception e) {
			e.printStackTrace(); 
		} 

	return mav;
	}


	/**  게시판>게시판>댓글 삭제하기 					
	* @Method Name  : deleteBoardCommentInfo   		
	* @작성일   : 2014년09월12일(14:05:50)                    		
	* @작성자   : 신용천(nComz)                    		
	* @변경이력  :                           		
	* @Method 설명 : 댓글 삭제하기                         		
	* @param request HttpServletRequest
	* @param response HttpServletResponse
	* @return mav                                	
	*/
 	@RequestMapping(value="/ajax/deleteBoardCommentInfo.do")
	public ModelAndNCOMZView deleteBoardCommentInfo(HttpServletRequest request, HttpServletResponse response) throws Exception {
			ModelAndNCOMZView mav   	= new ModelAndNCOMZView(request,new MappingJacksonJsonView());
	HttpRequest requestUtil = new HttpRequest(request); 
	LinkedHashMap param = requestUtil.paramBind(); 
	int resultInt1 = 0;
	try {
		resultInt1 = boardService.deleteBoardCommentInfo(param);
		mav.addObject("resultInt1", resultInt1); 
		} catch (Exception e) {
			e.printStackTrace(); 
		} 

	return mav;
	}

}
